ATAN2 block

Short summary

Name

ATAN2

→POU type

→function

Category

IEC-block, Numeric

Conform to →IEC-standard

(tick) no restrictions

Graphical interface

Available since

  • version 1.18.0 (for Neuron Power Engineer) – initial variant: inputs IN1 and IN2

  • version 1.58.0 (for Neuron Power Engineer) – enhancement: names of inputs changed to Y und X

  • version 3.1.0 (for library Standard) – For inputs of data type REAL, the optimized float variant of the C-runtime is used. Compared to previous versions, it is possible that (marginal) other results are returned within the threshold range of the block. 

Functionality

The trigonometric function arctan is called: The block calculates the arc tangent with 2 parameters. In contrast to the ATAN block, this block observes the sign of both parameters and determines the quadrant of the result.

The return value of the block is the angle in the Cartesian plane between the X-axis and a vector that is pointing from the origin (0,0) to the point (X,Y). The block returns the result in radians, in the range of -PI to +PI (including). The angle is positive for counter-clockwise angles (upper halfplane, Y > 0) and negative for clockwise angles (lower half-plane, Y < 0).

Inputs, return value

 

Identifier

→Data type

Description

Inputs:

Y

REAL, LREAL
(corresponds to →generic data type ANY_REAL)

Y-coordinate

X

REAL, LREAL
(corresponds to →generic data type ANY_REAL)

X-coordinate

Return value:

REAL, LREAL
(corresponds to →generic data type ANY_REAL)

 

Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Example for usage within ST-editor

PROGRAM Test
   VAR
      result : REAL;
   END_VAR
   result := ATAN2(Y := 1000.0, X := 50.0);    (* The variable 'result' evaluates to '1.520838'. *)
END_PROGRAM

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.